Skip to content

Conversation

@p-monteiro
Copy link

@p-monteiro p-monteiro commented Sep 23, 2025

[DO NOT MERGE]

️ATTENTION

This PR changes the domain of the integration, so current users will lose their device configs!
The config schema also changed, so verify your YAML if you use it to configure the devices.

This PR introduces a rewrite of this integration. The main goal of this was to better align the integration with the Home Assistant (HA) development workflow with two main changes:

  • Completely separate device API code from HA code
  • Align with code style guidelines (mainly Ruff code formatting and full typing)

Other changes that are present in this PR:

  • Async device communication
  • Use a device coordinator to fetch data from the device
  • Device Features are user-selectable since the Gree API does not provide a reliable method of getting them
  • Improvements to entity creation and config flow with better errors and organization
  • Gree API functions are better structured and clearer to understand the logic, which is also reused when possible
  • Gree API is fully declarative, no string guessing
  • Gree API now provides a GreeDevice object to handle device logic
  • Implement Auto Encryption version
  • Expose entity restore behavior as a configuration
  • Properly allow to reconfigure a config entry (including device connection, useful for when a device changes IP)
  • RestoreEntity support in ClimateEntity
  • Exposed all device sensors as entities
  • Allow to set the device temperature units (shown on the device display)

I want full feature parity with the current integration and iron out some bugs before this is ready to merge (if you so wish). Currently missing and wishlist:

  • [Missing] Update the manual config instructions
  • [Bug] Broken VRF Device Status
  • [Wishilist] Move device state to the coordinator

As you can see, there are a lot of changes, and I understand if this does not go through as is.
I am creating the PR mainly to gather feedback and track progress since most features are now present in this PR.
Don't treat this PR as blocking. I am tracking new changes and integrating them as they are committed.

Also, since this is a big rewrite, I wonder if we should use it to bump the major version (4?) and possibly change the domain to not replace the official integration (as I saw in the bug reports that it might impose some problems).

- Change config flow to: be multi step and allow setting the device features; allow to reconfigure an entry
- Separate HA and Device API logic: device API is now declarative and handles device behaviour. HA entities expose the device
- Implement a coordinator
- Async device communication
- More error handling
- Move consts around
- Proper error report on config_flow
- Proper translations on config_flow
- Configuration of timeout
- Fetch device info during binding
@p-monteiro
Copy link
Author

@RobHofmann I was adding the temperature step back, but I'm not sure of its utility.
Is there any device that accepts non-integer ºC/ºF?

@domialex
Copy link
Contributor

@p-monteiro
The temperature step should not be in the configuration entities anyways, it should be in the climate options. That was a mistake on my part.

@p-monteiro
Copy link
Author

Hi @domialex, that's fine. I'm more interested in the real use case for it. Should it be locked to integers? I don't think any device supports half degrees or even 0.1 steps, as is the lower limit for the current slider...

Unfortunately we can't use the EntitySelector as it doesn't allow for unsetting a previously set value
@p-monteiro
Copy link
Author

I pushed the domain change, beware!

@RobHofmann
Copy link
Owner

@RobHofmann @meirlo @domialex I'd like your input on some decisions that are blocking this.

  1. Since this is a big rewrite, I wonder if we should use it to bump the major version (4?) and possibly change the domain to not replace the official integration (as I saw in the bug reports that it might impose some problems). What do you think? This is blocking the config migration feature, as if we change the domain, there's no need to migrate. Users will need to re-add the devices.
  2. I was adding the temperature step back, but I'm not sure of its utility. Is there any device that accepts non-integer ºC/ºF? What's the practical use case here?
  1. I think its good to take this into account if we are doing a big rewrite anyway, but you've already done it; so good.
  2. My device is able to step in 0,5 degrees (celcius).

@p-monteiro
Copy link
Author

2. My device is able to step in 0,5 degrees (celcius).

@RobHofmann Ah ok, I'll add it back. Would a bool for "Supports half increments" be better?

@RobHofmann
Copy link
Owner

2. My device is able to step in 0,5 degrees (celcius).

@RobHofmann Ah ok, I'll add it back. Would a bool for "Supports half increments" be better?

I would leave the steps option. people can then choose how to do this (even 0.1's are theoretically possible).

@p-monteiro
Copy link
Author

@RobHofmann I re-added the temperature step, but I limited it to 0.5 increments as the API only supports half ºC and integer ºF. A warning is logged if a non-integer ºF is set, since it is rounded to the nearest integer.

@meirlo
Copy link
Contributor

meirlo commented Oct 8, 2025

@meirlo Good catch, I also noticed the subList request uses the default key and not the specific device key, so I also changed to that. Now I'm not sure if this works because the device key is actually the generic one, or the sublist requires the generic one. I've updated the code. Please try whenever you can.

Sorry it took me a while, quite busy lately.
the subList now works, but I'm getting an error message when selecting the device:
image

here is the log:

2025-10-08 23:09:08.334 DEBUG (MainThread) [custom_components.gree.config_flow] Found broadcast addresses from HA: ['255.255.255.255']
2025-10-08 23:09:08.334 DEBUG (MainThread) [custom_components.gree.gree_api] Sending broadcast to 255.255.255.255
2025-10-08 23:09:08.334 DEBUG (MainThread) [custom_components.gree.gree_api] Sending broadcast to 192.168.255.255
2025-10-08 23:09:08.334 DEBUG (MainThread) [custom_components.gree.gree_api] Sending broadcast to 10.255.255.255
2025-10-08 23:09:08.335 DEBUG (MainThread) [custom_components.gree.gree_api] Sending broadcast to 172.31.255.255
2025-10-08 23:09:08.335 DEBUG (MainThread) [custom_components.gree.gree_api] Sent broadcast packets, waiting for replies... 
2025-10-08 23:09:13.404 DEBUG (MainThread) [custom_components.gree.gree_api] Got 2 responses in 5 seconds: {'192.168.69.11': '{"t":"pack","i":1,"uid":0,"cid":"","tcid":"","pack":"LP24Ek0OaYogxs3iQLjL4GxVgUZU3rtYupe1YWCCZzmMa9lM2RqI/KytvJ32IsGSZXrOr+MakVzzXHbghPeyiui/giRwi/22P1NeJSbhyoDt21IYC5nmTB0FSNCtGSQCCP/IZpjNt09zcc1aLtS4znlSqBQy8N/2MMZVqZoAQkkJPRFZzjLrUDkhvMjz32yVMkOVsFsTAafzePY7qSehbZIhsbG6Ck8X1+GBAEqEtdxSARmdHzsfl0hV7CQKMyULqf7+wHqDf2mz9uzNFv2ejQPpn0gG1yCMDrcqGdH2dZ87NZwcceL02wWBXsdkOjw4Ulrqi8VIr2r3Cmrm4wCp4K/UPK7Wvj+xDUBarOvvfc+86x4l/dRoudCtrydSECrA"}', '192.168.69.10': '{"t":"pack","cid":"580d0d30225f","tcid":"app","uid":0,"i":1,"pack":"bkVMP61MVBCj+bKj6Nc/0xEr+tLgPK36TXqIj6rcC74JTQTQIGpNxI8D1U8tSJB1pEr7RuJkLnXf1f/7trvXW5M3btthpc8M0pRZm6+g5N2LTf/WV/dAWpRvIRJkq16rT+A+pJrQeGdAWwN6kxXhvK/YNUtrUMnpV863TeyoLi2o90+ZgYyLoH1N26RgWIimQIoYkO/+w8rSr1nvVeJEc9vgCMb5UKzgzUy/KfaBXZXZgQaJ54sp4j+tIDgPXwVO"}\n'}
2025-10-08 23:09:13.404 DEBUG (MainThread) [custom_components.gree.gree_api] Decoding pack: b'{"t":"dev","cid":"c03937873cb5","bc":"00000000000000000000000000000000","brand":"gree","catalog":"gree","mac":"c03937873cb5","mid":"10001","model":"gree","name":"","lock":0,"series":"gree","vender":"1","ver":"V2.0.0","ModelType":"21200896","hid":"362001065279+U-WB05RT13V1.23.bin"}\x07\x07\x07\x07\x07\x07\x07'
2025-10-08 23:09:13.405 DEBUG (MainThread) [custom_components.gree.gree_api] Discovered device: GreeDiscoveredDevice(name='Gree 3cb5', host='192.168.69.11', mac='c03937873cb5', port=7000, brand='gree', model='gree', uid=0)
2025-10-08 23:09:13.405 DEBUG (MainThread) [custom_components.gree.gree_api] Decoding pack: b'{"t":"dev","bc":"","catalog":"gree","series":"gree","model":"gree","lock":0,"vender":"1","mid":"60","name":"GR-Gcloud_60_0a_225f_EC","ver":"V3.2.M","mac":"580d0d30225f","subCnt":4}\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c'
2025-10-08 23:09:13.405 DEBUG (MainThread) [custom_components.gree.gree_api] Trying to fetching sub-devices for '580d0d30225f' (subCount=4)
2025-10-08 23:09:13.405 INFO (MainThread) [custom_components.gree.gree_api] Trying to retrieve device encryption key v1
2025-10-08 23:09:13.405 DEBUG (MainThread) [custom_components.gree.gree_api] Bind Pack: {"mac": "580d0d30225f", "t": "bind", "uid": 0}
2025-10-08 23:09:13.405 DEBUG (MainThread) [custom_components.gree.gree_api] Fetching data from 192.168.69.10
2025-10-08 23:09:13.453 DEBUG (MainThread) [custom_components.gree.gree_api] Decoding pack: b'{"t":"bindOk","r":200,"mac":"580d0d30225f","key":"3de498fe6382a411"}\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c'
2025-10-08 23:09:13.453 DEBUG (MainThread) [custom_components.gree.gree_api] Got data from 192.168.69.10: {'t': 'pack', 'cid': '580d0d30225f', 'tcid': 'app', 'uid': 0, 'i': 1, 'pack': {'t': 'bindOk', 'r': 200, 'mac': '580d0d30225f', 'key': '3de498fe6382a411'}}
2025-10-08 23:09:13.453 INFO (MainThread) [custom_components.gree.gree_api] Fetched device encryption key with version 1 with success
2025-10-08 23:09:13.453 DEBUG (MainThread) [custom_components.gree.gree_api] Fetched encryption key: 3de498fe6382a411
2025-10-08 23:09:13.454 DEBUG (MainThread) [custom_components.gree.gree_api] Sub Bind Pack: {"mac": "580d0d30225f", "i": 1}
2025-10-08 23:09:13.456 DEBUG (MainThread) [custom_components.gree.gree_api] Fetching data from 192.168.69.10
2025-10-08 23:09:13.477 DEBUG (MainThread) [custom_components.gree.gree_api] Decoding pack: b'{"t":"subList","i":1,"c":4,"r":200,"list":[{"mac":"293b824d550000","mid":"608f"},{"mac":"69630f1e000000","mid":"605c"},{"mac":"57be8c4dce0000","mid":"608f"}]}\x02\x02'
2025-10-08 23:09:13.478 DEBUG (MainThread) [custom_components.gree.gree_api] Got data from 192.168.69.10: {'t': 'pack', 'cid': '580d0d30225f', 'tcid': 'app', 'uid': 0, 'i': 1, 'pack': {'t': 'subList', 'i': 1, 'c': 4, 'r': 200, 'list': [{'mac': '293b824d550000', 'mid': '608f'}, {'mac': '69630f1e000000', 'mid': '605c'}, {'mac': '57be8c4dce0000', 'mid': '608f'}]}}
2025-10-08 23:09:13.478 DEBUG (MainThread) [custom_components.gree.gree_api] Discovered sub-device: GreeDiscoveredDevice(name='GR-Gcloud_60_0a_225f_EC', host='192.168.69.10', mac='580d0d30225f', port=7000, brand='gree', model='gree', uid=0)
2025-10-08 23:09:13.478 DEBUG (MainThread) [custom_components.gree.gree_api] Discovered sub-device: GreeDiscoveredDevice(name='GR-Gcloud_60_0a_225f_EC', host='192.168.69.10', mac='580d0d30225f', port=7000, brand='gree', model='gree', uid=0)
2025-10-08 23:09:13.478 DEBUG (MainThread) [custom_components.gree.gree_api] Discovered sub-device: GreeDiscoveredDevice(name='GR-Gcloud_60_0a_225f_EC', host='192.168.69.10', mac='580d0d30225f', port=7000, brand='gree', model='gree', uid=0)
2025-10-08 23:09:19.483 INFO (MainThread) [custom_components.gree.gree_device] Initialize the GREE Device API for: 293b824d550000@580d0d30225f (192.168.69.10:7000)
2025-10-08 23:09:19.483 DEBUG (MainThread) [custom_components.gree.gree_device] Version: None, Key: 
2025-10-08 23:09:19.483 DEBUG (MainThread) [custom_components.gree.gree_device] Trying to get device status
2025-10-08 23:09:19.483 DEBUG (MainThread) [custom_components.gree.gree_api] Fetching data from 192.168.69.10
2025-10-08 23:09:19.492 DEBUG (MainThread) [custom_components.gree.gree_api] Decoding pack: b'{"t":"dev","bc":"","catalog":"gree","series":"gree","model":"gree","lock":0,"vender":"1","mid":"60","name":"GR-Gcloud_60_0a_225f_EC","ver":"V3.2.M","mac":"580d0d30225f","subCnt":4}\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c'
2025-10-08 23:09:19.492 DEBUG (MainThread) [custom_components.gree.gree_api] Got data from 192.168.69.10: {'t': 'pack', 'cid': '580d0d30225f', 'tcid': 'app', 'uid': 0, 'i': 1, 'pack': {'t': 'dev', 'bc': '', 'catalog': 'gree', 'series': 'gree', 'model': 'gree', 'lock': 0, 'vender': '1', 'mid': '60', 'name': 'GR-Gcloud_60_0a_225f_EC', 'ver': 'V3.2.M', 'mac': '580d0d30225f', 'subCnt': 4}}
2025-10-08 23:09:19.492 DEBUG (MainThread) [custom_components.gree.gree_api] {'t': 'dev', 'bc': '', 'catalog': 'gree', 'series': 'gree', 'model': 'gree', 'lock': 0, 'vender': '1', 'mid': '60', 'name': 'GR-Gcloud_60_0a_225f_EC', 'ver': 'V3.2.M', 'mac': '580d0d30225f', 'subCnt': 4}
2025-10-08 23:09:19.493 INFO (MainThread) [custom_components.gree.gree_device] No encryption key provided
2025-10-08 23:09:19.493 INFO (MainThread) [custom_components.gree.gree_api] Trying to retrieve device encryption key v1
2025-10-08 23:09:19.493 DEBUG (MainThread) [custom_components.gree.gree_api] Bind Pack: {"mac": "580d0d30225f", "t": "bind", "uid": 0}
2025-10-08 23:09:19.493 DEBUG (MainThread) [custom_components.gree.gree_api] Fetching data from 192.168.69.10
2025-10-08 23:09:19.504 DEBUG (MainThread) [custom_components.gree.gree_api] Decoding pack: b'{"t":"bindOk","r":200,"mac":"580d0d30225f","key":"3de498fe6382a411"}\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c'
2025-10-08 23:09:19.505 DEBUG (MainThread) [custom_components.gree.gree_api] Got data from 192.168.69.10: {'t': 'pack', 'cid': '580d0d30225f', 'tcid': 'app', 'uid': 0, 'i': 1, 'pack': {'t': 'bindOk', 'r': 200, 'mac': '580d0d30225f', 'key': '3de498fe6382a411'}}
2025-10-08 23:09:19.505 INFO (MainThread) [custom_components.gree.gree_api] Fetched device encryption key with version 1 with success
2025-10-08 23:09:19.505 DEBUG (MainThread) [custom_components.gree.gree_api] Fetched encryption key: 3de498fe6382a411
2025-10-08 23:09:19.505 DEBUG (MainThread) [custom_components.gree.gree_api] Trying to get device status
2025-10-08 23:09:19.505 DEBUG (MainThread) [custom_components.gree.gree_api] Status Pack: {"cols": ["Pow", "Mod", "WdSpd", "SetTem", "TemRec", "TemUn", "SwingLfRig", "SwUpDn", "Quiet", "Tur", "Air", "Blo", "Health", "SwhSlp", "SlpMod", "Lig", "StHt", "SvSt", "AntiDirectBlow", "LigSen", "TemSen", "OutEnvTem", "DwatSen", "HeatCoolType"], "mac": "293b824d550000", "t": "status"}
2025-10-08 23:09:19.505 DEBUG (MainThread) [custom_components.gree.gree_api] Fetching data from 192.168.69.10
2025-10-08 23:09:19.534 DEBUG (MainThread) [custom_components.gree.gree_api] Decoding pack: b'{"t":"dat","mac":"293b824d550000","cols":["Pow","Mod","WdSpd","SetTem","TemRec","TemUn","SwingLfRig","SwUpDn","Quiet","Tur","Air","Blo","Health","SwhSlp","SlpMod","Lig","StHt","SvSt","AntiDirectBlow","LigSen","TemSen","OutEnvTem","DwatSen","HeatCoolType"],"dat":[0,1,0,24,"","",0,0,0,0,0,0,"",0,"","","",0,"","","","","",""],"r":200}\x03\x03\x03'
2025-10-08 23:09:19.534 DEBUG (MainThread) [custom_components.gree.gree_api] Got data from 192.168.69.10: {'t': 'pack', 'cid': '580d0d30225f', 'tcid': 'app', 'uid': 0, 'i': 0, 'pack': {'t': 'dat', 'mac': '293b824d550000', 'cols': ['Pow', 'Mod', 'WdSpd', 'SetTem', 'TemRec', 'TemUn', 'SwingLfRig', 'SwUpDn', 'Quiet', 'Tur', 'Air', 'Blo', 'Health', 'SwhSlp', 'SlpMod', 'Lig', 'StHt', 'SvSt', 'AntiDirectBlow', 'LigSen', 'TemSen', 'OutEnvTem', 'DwatSen', 'HeatCoolType'], 'dat': [0, 1, 0, 24, '', '', 0, 0, 0, 0, 0, 0, '', 0, '', '', '', 0, '', '', '', '', '', ''], 'r': 200}}
2025-10-08 23:09:21.064 INFO (MainThread) [custom_components.gree.gree_device] Initialize the GREE Device API for: 293b824d550000@580d0d30225f (192.168.69.10:7000)
2025-10-08 23:09:21.064 DEBUG (MainThread) [custom_components.gree.gree_device] Version: None, Key: 
2025-10-08 23:09:21.064 DEBUG (MainThread) [custom_components.gree.gree_device] Trying to get device status
2025-10-08 23:09:21.064 DEBUG (MainThread) [custom_components.gree.gree_api] Fetching data from 192.168.69.10
2025-10-08 23:09:21.080 DEBUG (MainThread) [custom_components.gree.gree_api] Decoding pack: b'{"t":"dev","bc":"","catalog":"gree","series":"gree","model":"gree","lock":0,"vender":"1","mid":"60","name":"GR-Gcloud_60_0a_225f_EC","ver":"V3.2.M","mac":"580d0d30225f","subCnt":4}\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c'
2025-10-08 23:09:21.080 DEBUG (MainThread) [custom_components.gree.gree_api] Got data from 192.168.69.10: {'t': 'pack', 'cid': '580d0d30225f', 'tcid': 'app', 'uid': 0, 'i': 1, 'pack': {'t': 'dev', 'bc': '', 'catalog': 'gree', 'series': 'gree', 'model': 'gree', 'lock': 0, 'vender': '1', 'mid': '60', 'name': 'GR-Gcloud_60_0a_225f_EC', 'ver': 'V3.2.M', 'mac': '580d0d30225f', 'subCnt': 4}}
2025-10-08 23:09:21.080 DEBUG (MainThread) [custom_components.gree.gree_api] {'t': 'dev', 'bc': '', 'catalog': 'gree', 'series': 'gree', 'model': 'gree', 'lock': 0, 'vender': '1', 'mid': '60', 'name': 'GR-Gcloud_60_0a_225f_EC', 'ver': 'V3.2.M', 'mac': '580d0d30225f', 'subCnt': 4}
2025-10-08 23:09:21.080 INFO (MainThread) [custom_components.gree.gree_device] No encryption key provided
2025-10-08 23:09:21.080 INFO (MainThread) [custom_components.gree.gree_api] Trying to retrieve device encryption key v1
2025-10-08 23:09:21.080 DEBUG (MainThread) [custom_components.gree.gree_api] Bind Pack: {"mac": "580d0d30225f", "t": "bind", "uid": 0}
2025-10-08 23:09:21.081 DEBUG (MainThread) [custom_components.gree.gree_api] Fetching data from 192.168.69.10
2025-10-08 23:09:21.094 DEBUG (MainThread) [custom_components.gree.gree_api] Decoding pack: b'{"t":"bindOk","r":200,"mac":"580d0d30225f","key":"3de498fe6382a411"}\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c'
2025-10-08 23:09:21.094 DEBUG (MainThread) [custom_components.gree.gree_api] Got data from 192.168.69.10: {'t': 'pack', 'cid': '580d0d30225f', 'tcid': 'app', 'uid': 0, 'i': 1, 'pack': {'t': 'bindOk', 'r': 200, 'mac': '580d0d30225f', 'key': '3de498fe6382a411'}}
2025-10-08 23:09:21.094 INFO (MainThread) [custom_components.gree.gree_api] Fetched device encryption key with version 1 with success
2025-10-08 23:09:21.094 DEBUG (MainThread) [custom_components.gree.gree_api] Fetched encryption key: 3de498fe6382a411
2025-10-08 23:09:21.095 DEBUG (MainThread) [custom_components.gree.gree_api] Trying to get device status
2025-10-08 23:09:21.095 DEBUG (MainThread) [custom_components.gree.gree_api] Status Pack: {"cols": ["Pow", "Mod", "WdSpd", "SetTem", "TemRec", "TemUn", "SwingLfRig", "SwUpDn", "Quiet", "Tur", "Air", "Blo", "Health", "SwhSlp", "SlpMod", "Lig", "StHt", "SvSt", "AntiDirectBlow", "LigSen", "TemSen", "OutEnvTem", "DwatSen", "HeatCoolType"], "mac": "293b824d550000", "t": "status"}
2025-10-08 23:09:21.095 DEBUG (MainThread) [custom_components.gree.gree_api] Fetching data from 192.168.69.10
2025-10-08 23:09:21.122 DEBUG (MainThread) [custom_components.gree.gree_api] Decoding pack: b'{"t":"dat","mac":"293b824d550000","cols":["Pow","Mod","WdSpd","SetTem","TemRec","TemUn","SwingLfRig","SwUpDn","Quiet","Tur","Air","Blo","Health","SwhSlp","SlpMod","Lig","StHt","SvSt","AntiDirectBlow","LigSen","TemSen","OutEnvTem","DwatSen","HeatCoolType"],"dat":[0,1,0,24,"","",0,0,0,0,0,0,"",0,"","","",0,"","","","","",""],"r":200}\x03\x03\x03'
2025-10-08 23:09:21.122 DEBUG (MainThread) [custom_components.gree.gree_api] Got data from 192.168.69.10: {'t': 'pack', 'cid': '580d0d30225f', 'tcid': 'app', 'uid': 0, 'i': 0, 'pack': {'t': 'dat', 'mac': '293b824d550000', 'cols': ['Pow', 'Mod', 'WdSpd', 'SetTem', 'TemRec', 'TemUn', 'SwingLfRig', 'SwUpDn', 'Quiet', 'Tur', 'Air', 'Blo', 'Health', 'SwhSlp', 'SlpMod', 'Lig', 'StHt', 'SvSt', 'AntiDirectBlow', 'LigSen', 'TemSen', 'OutEnvTem', 'DwatSen', 'HeatCoolType'], 'dat': [0, 1, 0, 24, '', '', 0, 0, 0, 0, 0, 0, '', 0, '', '', '', 0, '', '', '', '', '', ''], 'r': 200}}

Please let me know if you have an idea where the issue is, or need me to debug further.
Thanks for investing time on that, really appreciate your's (and everyone else) efforts to support VRF

@p-monteiro
Copy link
Author

@meirlo Thanks for your patience with us.
I've improved the debug and some typos to actually surface the error in the logs.
I suspect now you will be able to add the device, but will have errors while using it.
Either way, please post the logs whenever you can.

@meirlo
Copy link
Contributor

meirlo commented Oct 9, 2025

here is the next error :)
image

2025-10-09 10:49:07.378 DEBUG (MainThread) [custom_components.gree] Setting up entry: <ConfigEntry entry_id=01K73Z08C98C2VCNE7CG496V3X version=2 domain=gree_custom title=GR-Gcloud_60_0a_225f_EC@293b state=ConfigEntryState.SETUP_IN_PROGRESS unique_id=293b824d550000>
{'name': 'GR-Gcloud_60_0a_225f_EC@293b', 'host': '192.168.69.10', 'mac': '293b824d550000@580d0d30225f', 'advanced': {'port': 7000, 'encryption_version': <EncryptionVersion.V1: 1>, 'encryption_key': '3de498fe6382a411', 'uid': 0, 'disable_available_check': False, 'max_online_attempts': 5, 'timeout': 10}, 'hvac_modes': ['auto', 'cool', 'dry', 'fan_only', 'heat', 'off'], 'fan_modes': ['Auto', 'Low', 'MediumLow', 'Medium', 'MediumHigh', 'High', 'turbo', 'quiet'], 'swing_modes': ['Default', 'FullSwing', 'FixedUpper', 'FixedUpperMiddle', 'FixedMiddle', 'FixedLowerMiddle', 'FixedLower', 'SwingLower', 'SwingLowerMiddle', 'SwingMiddle', 'SwingUpperMiddle', 'SwingUpper'], 'swing_horizontal_modes': ['Default', 'FullSwing', 'Left', 'LeftCenter', 'Center', 'RightCenter', 'Right'], 'features': ['beeper', 'air', 'xfan', 'sleep', 'eightdegheat', 'lights', 'health', 'anti_direct_blow', 'powersave', 'light_sensor'], 'target_temp_step': 1.0, 'external_temperature_sensor': 'None', 'external_humidity_sensor': 'None', 'restore_states': True}
2025-10-09 10:49:07.378 INFO (MainThread) [custom_components.gree.gree_device] Initialize the GREE Device API for: 293b824d550000@580d0d30225f (192.168.69.10:7000)
2025-10-09 10:49:07.378 DEBUG (MainThread) [custom_components.gree.gree_device] Version: 1, Key: 3de49
2025-10-09 10:49:07.378 DEBUG (MainThread) [custom_components.gree.gree_api] Fetching data from 192.168.69.10
2025-10-09 10:49:07.391 DEBUG (MainThread) [custom_components.gree.gree_api] Decoding pack: b'{"t":"dev","bc":"","catalog":"gree","series":"gree","model":"gree","lock":0,"vender":"1","mid":"60","name":"GR-Gcloud_60_0a_225f_EC","ver":"V3.2.M","mac":"580d0d30225f","subCnt":4}\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c'
2025-10-09 10:49:07.391 DEBUG (MainThread) [custom_components.gree.gree_api] Got data from 192.168.69.10: {'t': 'pack', 'cid': '580d0d30225f', 'tcid': 'app', 'uid': 0, 'i': 1, 'pack': {'t': 'dev', 'bc': '', 'catalog': 'gree', 'series': 'gree', 'model': 'gree', 'lock': 0, 'vender': '1', 'mid': '60', 'name': 'GR-Gcloud_60_0a_225f_EC', 'ver': 'V3.2.M', 'mac': '580d0d30225f', 'subCnt': 4}}
2025-10-09 10:49:07.391 DEBUG (MainThread) [custom_components.gree.gree_api] {'t': 'dev', 'bc': '', 'catalog': 'gree', 'series': 'gree', 'model': 'gree', 'lock': 0, 'vender': '1', 'mid': '60', 'name': 'GR-Gcloud_60_0a_225f_EC', 'ver': 'V3.2.M', 'mac': '580d0d30225f', 'subCnt': 4}
2025-10-09 10:49:07.391 INFO (MainThread) [custom_components.gree.gree_device] Using the provided encryption key with version 1
2025-10-09 10:49:07.391 DEBUG (MainThread) [custom_components.gree] Bound to device 192.168.69.10
2025-10-09 10:49:07.392 DEBUG (MainThread) [custom_components.gree.gree_device] Trying to get device status
2025-10-09 10:49:07.392 DEBUG (MainThread) [custom_components.gree.gree_api] Trying to get device status
2025-10-09 10:49:07.392 DEBUG (MainThread) [custom_components.gree.gree_api] Status Pack: {"cols": ["Pow", "Mod", "WdSpd", "SetTem", "TemRec", "TemUn", "SwingLfRig", "SwUpDn", "Quiet", "Tur", "Air", "Blo", "Health", "SwhSlp", "SlpMod", "Lig", "StHt", "SvSt", "AntiDirectBlow", "LigSen", "TemSen", "OutEnvTem", "DwatSen", "HeatCoolType"], "mac": "293b824d550000", "t": "status"}
2025-10-09 10:49:07.392 DEBUG (MainThread) [custom_components.gree.gree_api] Payload: {'cid': 'app', 'i': 0, 'pack': 'rZ8nuCEJpoBu9vx086El1RSlbVikgZfPvjPf25P1+DHJPwAdkGW83HJT5abT6TQegRcAvA+oPIL9kXRTSYzjpb6nQJhHxz+YnRx94uW0AMu08lLB3tsGKBLEmuXb5+227wRXS/txAIUehIfUyxBACriWqq+oEYiIcFjj/JyuNhTet4NWL+fArjVUEDRohEV7R+O6ri6vzyp/b/6tz9M1zd6usC/J/Dv/WO2RPJkoDucFnTnNMd8GFpKi4r/IpjVTREiM+QSzNYplEq+nN/xE3QfEK8F9NuvUmZNuVs8gtHhgeJYpxoevfG1lwclfW5lM+LYlxEgOqV09fJzfRkE1eoXCT/rAP8tT2X1faBzfQv7ay1B/8b6/9TXbJ/tGwkaY', 't': 'pack', 'tcid': '580d0d30225f', 'uid': 0}
2025-10-09 10:49:07.392 DEBUG (MainThread) [custom_components.gree.gree_api] Fetching data from 192.168.69.10
2025-10-09 10:49:07.420 DEBUG (MainThread) [custom_components.gree.gree_api] Decoding pack: b'{"t":"dat","mac":"293b824d550000","cols":["Pow","Mod","WdSpd","SetTem","TemRec","TemUn","SwingLfRig","SwUpDn","Quiet","Tur","Air","Blo","Health","SwhSlp","SlpMod","Lig","StHt","SvSt","AntiDirectBlow","LigSen","TemSen","OutEnvTem","DwatSen","HeatCoolType"],"dat":[0,1,0,24,"","",0,0,0,0,0,0,"",0,"","","",0,"","","","","",""],"r":200}\x03\x03\x03'
2025-10-09 10:49:07.421 DEBUG (MainThread) [custom_components.gree.gree_api] Got data from 192.168.69.10: {'t': 'pack', 'cid': '580d0d30225f', 'tcid': 'app', 'uid': 0, 'i': 0, 'pack': {'t': 'dat', 'mac': '293b824d550000', 'cols': ['Pow', 'Mod', 'WdSpd', 'SetTem', 'TemRec', 'TemUn', 'SwingLfRig', 'SwUpDn', 'Quiet', 'Tur', 'Air', 'Blo', 'Health', 'SwhSlp', 'SlpMod', 'Lig', 'StHt', 'SvSt', 'AntiDirectBlow', 'LigSen', 'TemSen', 'OutEnvTem', 'DwatSen', 'HeatCoolType'], 'dat': [0, 1, 0, 24, '', '', 0, 0, 0, 0, 0, 0, '', 0, '', '', '', 0, '', '', '', '', '', ''], 'r': 200}}
2025-10-09 10:49:07.421 DEBUG (MainThread) [custom_components.gree.coordinator] Finished fetching Gree Coordinator 293b824d550000 data in 0.029 seconds (success: False)
2025-10-09 10:49:27.723 DEBUG (MainThread) [custom_components.gree] Setting up entry: <ConfigEntry entry_id=01K73Z08C98C2VCNE7CG496V3X version=2 domain=gree_custom title=GR-Gcloud_60_0a_225f_EC@293b state=ConfigEntryState.SETUP_IN_PROGRESS unique_id=293b824d550000>
{'name': 'GR-Gcloud_60_0a_225f_EC@293b', 'host': '192.168.69.10', 'mac': '293b824d550000@580d0d30225f', 'advanced': {'port': 7000, 'encryption_version': <EncryptionVersion.V1: 1>, 'encryption_key': '3de498fe6382a411', 'uid': 0, 'disable_available_check': False, 'max_online_attempts': 5, 'timeout': 10}, 'hvac_modes': ['auto', 'cool', 'dry', 'fan_only', 'heat', 'off'], 'fan_modes': ['Auto', 'Low', 'MediumLow', 'Medium', 'MediumHigh', 'High', 'turbo', 'quiet'], 'swing_modes': ['Default', 'FullSwing', 'FixedUpper', 'FixedUpperMiddle', 'FixedMiddle', 'FixedLowerMiddle', 'FixedLower', 'SwingLower', 'SwingLowerMiddle', 'SwingMiddle', 'SwingUpperMiddle', 'SwingUpper'], 'swing_horizontal_modes': ['Default', 'FullSwing', 'Left', 'LeftCenter', 'Center', 'RightCenter', 'Right'], 'features': ['beeper', 'air', 'xfan', 'sleep', 'eightdegheat', 'lights', 'health', 'anti_direct_blow', 'powersave', 'light_sensor'], 'target_temp_step': 1.0, 'external_temperature_sensor': 'None', 'external_humidity_sensor': 'None', 'restore_states': True}
2025-10-09 10:49:27.723 INFO (MainThread) [custom_components.gree.gree_device] Initialize the GREE Device API for: 293b824d550000@580d0d30225f (192.168.69.10:7000)
2025-10-09 10:49:27.723 DEBUG (MainThread) [custom_components.gree.gree_device] Version: 1, Key: 3de49
2025-10-09 10:49:27.723 DEBUG (MainThread) [custom_components.gree.gree_api] Fetching data from 192.168.69.10
2025-10-09 10:49:27.741 DEBUG (MainThread) [custom_components.gree.gree_api] Decoding pack: b'{"t":"dev","bc":"","catalog":"gree","series":"gree","model":"gree","lock":0,"vender":"1","mid":"60","name":"GR-Gcloud_60_0a_225f_EC","ver":"V3.2.M","mac":"580d0d30225f","subCnt":4}\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c'
2025-10-09 10:49:27.741 DEBUG (MainThread) [custom_components.gree.gree_api] Got data from 192.168.69.10: {'t': 'pack', 'cid': '580d0d30225f', 'tcid': 'app', 'uid': 0, 'i': 1, 'pack': {'t': 'dev', 'bc': '', 'catalog': 'gree', 'series': 'gree', 'model': 'gree', 'lock': 0, 'vender': '1', 'mid': '60', 'name': 'GR-Gcloud_60_0a_225f_EC', 'ver': 'V3.2.M', 'mac': '580d0d30225f', 'subCnt': 4}}
2025-10-09 10:49:27.741 DEBUG (MainThread) [custom_components.gree.gree_api] {'t': 'dev', 'bc': '', 'catalog': 'gree', 'series': 'gree', 'model': 'gree', 'lock': 0, 'vender': '1', 'mid': '60', 'name': 'GR-Gcloud_60_0a_225f_EC', 'ver': 'V3.2.M', 'mac': '580d0d30225f', 'subCnt': 4}
2025-10-09 10:49:27.741 INFO (MainThread) [custom_components.gree.gree_device] Using the provided encryption key with version 1
2025-10-09 10:49:27.741 DEBUG (MainThread) [custom_components.gree] Bound to device 192.168.69.10
2025-10-09 10:49:27.741 DEBUG (MainThread) [custom_components.gree.gree_device] Trying to get device status
2025-10-09 10:49:27.741 DEBUG (MainThread) [custom_components.gree.gree_api] Trying to get device status
2025-10-09 10:49:27.741 DEBUG (MainThread) [custom_components.gree.gree_api] Status Pack: {"cols": ["Pow", "Mod", "WdSpd", "SetTem", "TemRec", "TemUn", "SwingLfRig", "SwUpDn", "Quiet", "Tur", "Air", "Blo", "Health", "SwhSlp", "SlpMod", "Lig", "StHt", "SvSt", "AntiDirectBlow", "LigSen", "TemSen", "OutEnvTem", "DwatSen", "HeatCoolType"], "mac": "293b824d550000", "t": "status"}
2025-10-09 10:49:27.742 DEBUG (MainThread) [custom_components.gree.gree_api] Payload: {'cid': 'app', 'i': 0, 'pack': 'rZ8nuCEJpoBu9vx086El1RSlbVikgZfPvjPf25P1+DHJPwAdkGW83HJT5abT6TQegRcAvA+oPIL9kXRTSYzjpb6nQJhHxz+YnRx94uW0AMu08lLB3tsGKBLEmuXb5+227wRXS/txAIUehIfUyxBACriWqq+oEYiIcFjj/JyuNhTet4NWL+fArjVUEDRohEV7R+O6ri6vzyp/b/6tz9M1zd6usC/J/Dv/WO2RPJkoDucFnTnNMd8GFpKi4r/IpjVTREiM+QSzNYplEq+nN/xE3QfEK8F9NuvUmZNuVs8gtHhgeJYpxoevfG1lwclfW5lM+LYlxEgOqV09fJzfRkE1eoXCT/rAP8tT2X1faBzfQv7ay1B/8b6/9TXbJ/tGwkaY', 't': 'pack', 'tcid': '580d0d30225f', 'uid': 0}
2025-10-09 10:49:27.742 DEBUG (MainThread) [custom_components.gree.gree_api] Fetching data from 192.168.69.10
2025-10-09 10:49:27.784 DEBUG (MainThread) [custom_components.gree.gree_api] Decoding pack: b'{"t":"dat","mac":"293b824d550000","cols":["Pow","Mod","WdSpd","SetTem","TemRec","TemUn","SwingLfRig","SwUpDn","Quiet","Tur","Air","Blo","Health","SwhSlp","SlpMod","Lig","StHt","SvSt","AntiDirectBlow","LigSen","TemSen","OutEnvTem","DwatSen","HeatCoolType"],"dat":[0,1,0,24,"","",0,0,0,0,0,0,"",0,"","","",0,"","","","","",""],"r":200}\x03\x03\x03'
2025-10-09 10:49:27.784 DEBUG (MainThread) [custom_components.gree.gree_api] Got data from 192.168.69.10: {'t': 'pack', 'cid': '580d0d30225f', 'tcid': 'app', 'uid': 0, 'i': 0, 'pack': {'t': 'dat', 'mac': '293b824d550000', 'cols': ['Pow', 'Mod', 'WdSpd', 'SetTem', 'TemRec', 'TemUn', 'SwingLfRig', 'SwUpDn', 'Quiet', 'Tur', 'Air', 'Blo', 'Health', 'SwhSlp', 'SlpMod', 'Lig', 'StHt', 'SvSt', 'AntiDirectBlow', 'LigSen', 'TemSen', 'OutEnvTem', 'DwatSen', 'HeatCoolType'], 'dat': [0, 1, 0, 24, '', '', 0, 0, 0, 0, 0, 0, '', 0, '', '', '', 0, '', '', '', '', '', ''], 'r': 200}}
2025-10-09 10:49:27.784 DEBUG (MainThread) [custom_components.gree.coordinator] Finished fetching Gree Coordinator 293b824d550000 data in 0.043 seconds (success: False)

BTW, I see that this integration does not override the official integration anymore and also the Gree logo is missing.

@p-monteiro
Copy link
Author

p-monteiro commented Oct 9, 2025

BTW, I see that this integration does not override the official integration anymore and also the Gree logo is missing.

@meirlo

That is intended. Once we go through with this PR, we can PR the logo on the official custom integration brands.

About the error, as predicted, the device was added, but now it is failing to get the status, which is weird since the log shows that it receives the status correctly, and there is no exception logged. I'll check later.

Update: Actually, I see that some important fields are blank. Do you happen to know if some of the properties are given by the main device while others are given by the subdevices? That can explain the problem. Also, can you provide screenshots of how the official app organizes the settings for the VRF?

@meirlo
Copy link
Contributor

meirlo commented Oct 12, 2025

Screenshot_20251012_142342_GREE+

The office AC is the only standalone one and is not part of the vrf system.

The living room is the main one, meaning it controls the cool/heat setting for all the vrf ac (since there only a single outdoor unit, it's impossible to set some indoor units to cool and some to heating), it is possible to change this setting for other ac units, but it will revert to Fan mode if that's conflict with the main ac.

Here are some screenshots from the bedroom ac:

Screenshot_20251012_142423_GREE+ Screenshot_20251012_142410_GREE+ Screenshot_20251012_142359_GREE+

Please let me know if you want a screenshot from a specific ac/page

@p-monteiro
Copy link
Author

p-monteiro commented Oct 12, 2025

@meirlo Thanks for the screenshots, I'm having a bit of a hard time understanding the options, not gonna lie.

More importantly, how would you expect the controls to work in Home Assistant in terms of devices and the controls they provide?
For example, would you prefer for all controls to be in all devices and when changing it goes to the fan (as you said), or the subdevices override the main device, or the controls not show for the subdevices, or another thing?

@meirlo
Copy link
Contributor

meirlo commented Oct 12, 2025

@p-monteiro does it looks different on your ac?
Because the standalone ac and the vrf looks very similar.
If some setting is not clear please let me know.

In home assistant, I believe each unit needs to be a separate device, with its own settings. similar to how it shows in the gree+ app.

The limitation of the mode that must be set on the main unit first, can be ignored.
It is possible to set a mode that conflicts with the main with the gree app or even the ac.

if one want to sync between the mode in all ac it can be done via automation, no need to over complicate the integration.

@p-monteiro
Copy link
Author

@meirlo The thing is, at first glance, the subdevices API does not provide some of the parameters that you want (they came empty in the status pack, but it needs to be further investigated), so maybe the official app sends commands to both the subunit and the main unit when you change the mode on the subunit. If that's the case, it can actually be easier to make the subunits override the main one, or just omit the properties altogether.

I just pushed a commit, please try it, and check if the main device can be discovered, added and it works. Ignore the subunits for a moment hehe

@p-monteiro
Copy link
Author

This might need some architectural changes in the way we communicate with the device (possibly to communicate with the main and sub devices for getting and setting the status)

@p-monteiro
Copy link
Author

@meirlo Another thing, in a VRF system all units are the same as the main one right? So the capabilities of them all are the same.

@meirlo
Copy link
Contributor

meirlo commented Oct 15, 2025

I'm getting an error when trying to add the entity without the sub unit

Logger: custom_components.gree.climate
Source: custom_components/gree/climate.py:846
integration: gree (documentation, issues)
First occurred: 5:37:20 PM (1 occurrence)
Last logged: 5:37:20 PM

Error in 'async_set_temperature'
Traceback (most recent call last):
  File "/config/custom_components/gree/gree_api.py", line 372, in fetch_result
    received_json = await udp_request_async(
                    ^^^^^^^^^^^^^^^^^^^^^^^^
        ip_addr, port, json_data, max_connection_attempts, timeout
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/config/custom_components/gree/gree_api.py", line 302, in udp_request_async
    raise ValueError(
        f"Failed to communicate with device '{ip_addr}:{port}' after {max_retries} attempts"
    )
ValueError: Failed to communicate with device '192.168.69.10:7000' after 5 attempts

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/config/custom_components/gree/gree_api.py", line 719, in gree_set_status
    result = await get_result_pack(
             ^^^^^^^^^^^^^^^^^^^^^^
    ...<7 lines>...
    )
    ^
  File "/config/custom_components/gree/gree_api.py", line 428, in get_result_pack
    data = await fetch_result(
           ^^^^^^^^^^^^^^^^^^^
    ...<7 lines>...
    )
    ^
  File "/config/custom_components/gree/gree_api.py", line 376, in fetch_result
    raise ValueError(f"Error communicating with {ip_addr}: {err}") from err
ValueError: Error communicating with 192.168.69.10: Failed to communicate with device '192.168.69.10:7000' after 5 attempts

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/config/custom_components/gree/gree_device.py", line 248, in update_device_status
    await gree_set_status(
    ...<10 lines>...
    )
  File "/config/custom_components/gree/gree_api.py", line 729, in gree_set_status
    raise ValueError("Error getting device status") from err
ValueError: Error getting device status

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/config/custom_components/gree/climate.py", line 846, in async_set_temperature
    await self.device.update_device_status()
  File "/config/custom_components/gree/gree_device.py", line 265, in update_device_status
    raise ValueError("Error setting device status") from err
ValueError: Error setting device status

For the second question, the indoor units are not always identical. For example, my living room ac is a different one than the rest.

Can you please elaborate which parameters are missing?

@p-monteiro
Copy link
Author

@meirlo I'm having a hard time debugging the issue, sorry. Please try the latest version and provide the full debug log, not only the exception.
Your error shows a problem communicating with the device, so either the connection is the problem or the pack sent to the device is invalid, and it does not respond correctly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants